home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: mvaccaro1@aol.com (MVaccaro1)
- Newsgroups: comp.lang.c
- Subject: Re: Newbie Questions
- Date: 21 Mar 1996 16:15:22 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4isgta$7cr@newsbf02.news.aol.com>
- References: <4irpc1$b8u@GRAPEVINE.LCS.MIT.EDU>
- Reply-To: mvaccaro1@aol.com (MVaccaro1)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- >Question #2
- >
- >Why does the scope of the external declaration not extend beyond >the
- >inner block?
- >
- >{
- > {
- > extern E;
- > E = 0;
- > }
- > E = 1;
- >}
-
- Your declare of the external variable E is only known in the block it is
- declared in. Had you wrote the code this way:
-
- extern int E;
-
- func( ... )
- {
- {
- E=0;
- }
- E=1;
- }
-
- E would be known to all references in the file.
-
- Where as
-
- func( ... )
- {
- extern int E;
- {
- E = 0;
- }
- E = 1;
- }
-
- E would only be known within function.
-
- >Question #3
- >
- >Is there any difference between these two declarations?
- >
- > char *s1 = "hello";
- > char s2[] = "hello";
- >
- >
- >Thanks for any help!
-
- try this little test and tell me what happens:
-
- main( )
- {
- char *s1 = "hello";
- char s2[ ] = "hello";
-
- printf( "Sizeof s1 %d\n Sizeof s2 %d\n", sizeof s1, sizeof s2 );
- return 0;
- }
-
- You may be surprised!
-
- Mike :->
- Design? What design! - I've too much coding to do...
-